#include<stdio.h>
#include<stdlib.h>
int search(int *p,int n,int key)
{
	int left=0,mid=(left+n)/2;
	while(left<mid)
	{
		if(key>p[mid])
		left=mid;
		else if(key==p[mid])
		return mid;
		else
		n=mid;
		mid=(left+n)/2;
	}
	if(key==p[left])
	return left;
	else if(key==p[n])
	return n;
	else
	return -1;
	
}
int main()
{
	int n,m;
	scanf("%d\n%d",&n,&m);
	int b[m];
	int *p=(int *)malloc(sizeof(int)*(n+6));
	for(int i=0;i<n;i++)
	{
		scanf("%d",&*(p+i));
	}
	for(int i=0;i<m;i++)
	{
		scanf("%d",&b[i]);
	}
	for(int i=0;i<m;i++)
	{
		if(i==m-1)
		printf("%d\n",search(p,n,b[i]));
		else
		printf("%d ",search(p,n,b[i]));
	}
	return 0;
}
 
